﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Glucometer.ModuleHandler;

namespace Glucometer
{
    public class TestRecord
    {
        public DeviceSettings RecordSetting { get; set; }

        private int _testResultValue;

        public int TestResultValue { get { return _testResultValue; } }

        private DateTime _testDateTime;

        public DateTime TestDateTime { get { return _testDateTime; } }

        //THIS ALWAYS STORES THE TEST RESULT VALUE IN DL FORMAT
        public TestRecord(int value, DateTime dt, TestUnit tu)
        {
            this._testResultValue = TestUnitConverter.Convert(value, tu, TestUnit.DL);
            this._testDateTime = dt;
        }

        public string getDisplayString(TestUnit tu)
        {
            return String.Format("{0} {1}{2}", _testDateTime.ToString("yy/MM/dd HH:mm"), 
                TestUnitConverter.Convert(_testResultValue, TestUnit.DL, tu), 
                tu.ToString());
        }
    }
}
